package com.io;

import java.io.*;

/**
 * @author zsj
 * @date 2023/4/21 12:28
 */
public class Input {
    public static void main(String[] args) {
        int numberRead = 0;
        InputStream inputStream = null;
        OutputStream outputStream = null;
        byte [] buf = new byte[512];
        if (args.length!=2){
            System.out.println("error");
            System.exit(0);
        }
        try {
            inputStream = new FileInputStream(args[0]);
            outputStream = new FileOutputStream(args[1]);
            while ((numberRead=inputStream.read(buf))!=-1){
                outputStream.write(buf,0,numberRead);
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        finally {
            try {
                inputStream.close();
                outputStream.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

}
